#include <iostream>
#include <algorithm>
#include <sstream>
#include <vector>
#include <string>
using namespace std;

template<class ElemType>
int ListCompare(vector<ElemType>& A, vector<ElemType>& B)
{
	int size = min(A.size(), B.size());
	for (int i = 0; i < size; i++)
	{
		if (A[i] == B[i])continue;
		if (A[i] < B[i]) return -1;
		if (A[i] > B[i]) return 1;
	}
	if (A.size() == B.size()) return 0;
	if (A.size() > B.size()) return 1;
	if (A.size() < B.size()) return -1;
}

template<class T>
void Purge_Sq(T a)
{
	string str;
	getchar();
	getline(cin, str);
	stringstream s1(str);
	getline(cin, str);
	stringstream s2(str);

	vector<T> v1, v2;
	T tmp;
	while (s1 >> tmp)
		v1.push_back(tmp);
	while (s2 >> tmp)
		v2.push_back(tmp);
	
	int jug = 0;
	if (v1.size())
	{
		for (const auto& e : v1)
		{
			if (jug) cout << ',';
			jug = 1;
			cout << e;
		}	cout << endl;
	}
	else cout << "NULL\n";
	jug = 0;
	if (v2.size())
	{
		for (const auto& e : v2)
		{
			if (jug) cout << ',';
			jug = 1;
			cout << e;
		}	cout << endl;
	}
	else cout << "NULL\n";
	cout << endl;
	cout << ListCompare(v1, v2);
}

int main()
{
	int t; cin >> t;
	if (t < 0 || t > 3) cout << "err";
	else if(t == 0)
		Purge_Sq(int());
	else if (t == 1)
		Purge_Sq(double());
	else if (t == 2)
		Purge_Sq(char());
	else if (t == 3)
		Purge_Sq(string());
	return 0;
}